import { IsDate, IsEnum, IsInt, IsOptional, IsPhoneNumber, IsString } from 'class-validator'
import { Type } from 'class-transformer'
import { CUserStatus, CGuardianRelation } from '../constant'

export class UpdateUserDto {
  @IsString()
  @IsOptional()
  userId?: string

  @IsString()
  @IsOptional()
  @IsPhoneNumber('CN')
  phone?: string

  @IsString()
  @IsOptional()
  userName?: string

  @IsString()
  @IsOptional()
  guarder?: string

  @IsString()
  @IsOptional()
  @IsPhoneNumber('CN')
  guarderPhone?: string

  @IsEnum(CGuardianRelation)
  @IsOptional()
  guarderRelation?: CGuardianRelation

  @IsOptional()
  @Type(() => Date)
  @IsDate()
  birthday?: Date

  @IsString()
  @IsOptional()
  school?: string

  @IsString()
  @IsOptional()
  province?: string

  @IsString()
  @IsOptional()
  city?: string

  @IsInt()
  @IsOptional()
  grade?: number

  @IsInt()
  @IsOptional()
  from?: number

  @IsEnum(CUserStatus)
  @IsOptional()
  status?: CUserStatus

  @IsString()
  @IsOptional()
  mark?: string

  @IsInt()
  @IsOptional()
  updateBy?: number

  @IsInt()
  @IsOptional()
  isDelete?: number
}
